/*
 * common.cpp
 *
 *  Created on: 2009-9-26
 *      Author: ws
 */
#include<string>
#include"common.hpp"
std::string Get_OPDType_Name(enum LOC_Type opdtype)
{
	switch(opdtype)
	{
	case SRC:
		return "SRC";
	case DEST:
		return "DEST";
	case IMPLICT_SRC:
		return "IMPLICT_SRC";
	case IMPLICT_DEST:
		return "IMPLICT_DEST";
	case SRC_MEM:
		return "SRC_MEM";
	case DEST_MEM:
		return "DEST_MEM";
	case CTR:
		return "CTR";
	default:
		assert("Get_Operand_Type_Name(enum OPDType): opdtype is not expected");
	}
}

enum Core TargetInfo::T_get_core(enum TargetInfo::PhysicalRegister reg)
{
	if(0< reg <= 64)
		return CORE_X;
	else if(64< reg <= 64 * 2)
		return CORE_Y;
	else if(64*2 < reg <= 64*3)
		return CORE_Z;
	else if(64*3 < reg <= 64 *4)
		return CORE_T;
	else if(64*4 < reg <= 64 * 4 + 32)
		return MU_U;
	else if(64 * 4 + 32 < reg <= 64 * 4 + 32*2)
		return MU_V;
	else if(64 * 4 + 32 *2 < reg <= 64 * 4 + 32 *3)
		return MU_W;
	else
	{
		assert("error"== "the RegMask::get_cluster(reg) : the reg is out of bound");
	}
}

